﻿using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xejen.Logger
{
    /// <inheritdoc cref="ILoggerManager"/>
    /// <typeparam name="TLoggerFactory"><inheritdoc cref="ILoggerFactory" path="/summary"/></typeparam>
    public abstract class LoggerManager<TLoggerFactory> : ILoggerManager
        where TLoggerFactory : ILoggerFactory
    {
        private readonly TLoggerFactory _loggerFactory;

        /// <inheritdoc cref="LoggerManager"/>
        /// <param name="loggerFactory">表示日志工厂</param>
        protected LoggerManager(TLoggerFactory loggerFactory)
        {
            _loggerFactory = loggerFactory;
        }

        /// <inheritdoc/>
        public ILogger<T> CreateLogger<T>()
        {
            return _loggerFactory.CreateLogger<T>();
        }

        /// <inheritdoc/>
        public ILogger CreateLogger(Type type)
        {
            return _loggerFactory.CreateLogger(type);
        }

        /// <inheritdoc/>
        public ILogger CreateLogger(string categoryName)
        {
            return _loggerFactory.CreateLogger(categoryName);
        }
    }
}
